home *** CD-ROM | disk | FTP | other *** search
/ Network PC / Network PC.iso / amiga utilities / communication / internet / amitcp3.0b / src.lha / src / amitcp / api / auto_inetaddr.c < prev    next >
Encoding:
Text File  |  1996-09-08  |  6.8 KB  |  230 lines

  1. /****** bsdsocket.library/inet_addr *****************************************
  2. *
  3. *   NAME
  4. *        inet_addr,  inet_network,  Inet_MakeAddr,  Inet_LnaOf,
  5. *        Inet_NetOf, Inet_NtoA - Internet address manipulation
  6. *
  7. *        inet_makeaddr, inet_lnaof, inet_netof,
  8. *        inet_ntoa -- inline/stub functions to handle structure arguments
  9. *
  10. *   SYNOPSIS
  11. *        #include <netinet/in.h>
  12. *
  13. *        addr = inet_addr(cp)
  14. *        D0               A0
  15. *
  16. *        unsigned long inet_addr(char *);
  17. *
  18. *        net = inet_network(cp)
  19. *        D0                 A0
  20. *        
  21. *        unsigned long inet_network(char *);
  22. *
  23. *        in_addr = Inet_MakeAddr(net, lna)
  24. *        D0                      D0   D1
  25. *
  26. *        unsigned long Inet_MakeAddr(long, long);
  27. *
  28. *        lna = Inet_LnaOf(in)
  29. *        D0               D0
  30. *
  31. *        long Inet_LnaOf(unsigned long);
  32. *
  33. *        net = Inet_NetOf(in)
  34. *        D0               D0
  35. *
  36. *        long Inet_NetOf(unsigned long);
  37. *
  38. *        addr = Inet_NtoA(in)
  39. *        DO               D0
  40. *
  41. *        char * Inet_NtoA(unsigned long);
  42. *
  43. *        
  44. *        in_addr = inet_makeaddr(net, lna)
  45. *
  46. *        struct in_addr inet_makeaddr(long, long);
  47. *
  48. *        lna = inet_lnaof(in)
  49. *
  50. *        int inet_lnaof(struct in_addr);
  51. *
  52. *        net = inet_netof(in)
  53. *
  54. *        int inet_netof(struct in_addr);
  55. *
  56. *        addr = inet_ntoa(in)
  57. *
  58. *        char * inet_ntoa(struct in_addr);
  59. *
  60. *   IMPLEMENTATION NOTE
  61. *        Return  value  of  Inet_MakeAddr()  and  argument  types  of
  62. *        Inet_LnaOf(), Inet_NetOf() and Inet_NtoA() are longs instead
  63. *        of  struct  in_addr.  The original behaviour  is achieved by
  64. *        using  included  stub  functions (lower case function names)
  65. *        which handle structure arguments.
  66. *
  67. *   DESCRIPTION
  68. *        The routines inet_addr() and inet_network()  each  interpret
  69. *        character  strings  representing  numbers  expressed  in the
  70. *        Internet standard `.' notation, returning  numbers  suitable
  71. *        for  use as Internet addresses and Internet network numbers,
  72. *        respectively.  The routine inet_makeaddr() takes an Internet
  73. *        network number and a local network address and constructs an
  74. *        Internet address from it.   The  routines  inet_netof()  and
  75. *        inet_lnaof()  break apart Internet host addresses, returning
  76. *        the network number and local network address  part,  respec-
  77. *        tively.
  78. *
  79. *        The routine inet_ntoa() returns a pointer to a string in the
  80. *        base 256 notation ``d.d.d.d'' described below.
  81. *
  82. *        All Internet address are returned in  network  order  (bytes
  83. *        ordered  from left to right).  All network numbers and local
  84. *        address parts are returned as machine format integer values.
  85. *
  86. *   INTERNET ADDRESSES
  87. *        Values specified using the `.'  notation  take  one  of  the
  88. *
  89. *        following forms:
  90. *
  91. *             a.b.c.d
  92. *             a.b.c
  93. *             a.b
  94. *             a
  95. *
  96. *        When four parts are specified, each is interpreted as a byte
  97. *        of data and assigned, from left to right, to  the four bytes
  98. *        of  an Internet address.  Note: when  an Internet address is
  99. *        viewed  as  a  32-bit  integer  quantity  on  little  endian
  100. *        systems,  the  bytes referred to  above appear  as  d.c.b.a.
  101. *        bytes are ordered from right to left.
  102. *
  103. *        When a three part address is specified,  the  last  part  is
  104. *        interpreted  as  a  16-bit  quantity and placed in the right
  105. *        most two bytes of the network address.  This makes the three
  106. *        part  address  format convenient for specifying Class B net-
  107. *        work addresses as "128.net.host".
  108. *
  109. *        When a two part address is supplied, the last part is inter-
  110. *        preted  as  a  24-bit  quantity and placed in the right most
  111. *        three bytes of the network address.  This makes the two part
  112. *        address  format  convenient  for  specifying Class A network
  113. *        addresses as "net.host".
  114. *
  115. *        When only one part is given, the value is stored directly in
  116. *        the network address without any byte rearrangement.
  117. *
  118. *        All numbers supplied as ``parts'' in a `.' notation  may  be
  119. *        decimal,  octal,  or  hexadecimal,  as  specified  in  the C
  120. *        language (that is, a leading 0x or 0X  implies  hexadecimal;
  121. *        otherwise,  a leading 0 implies octal; otherwise, the number
  122. *        is interpreted as decimal).
  123. *
  124. *   RETURN VALUE
  125. *        The value -1 is returned by inet_addr()  and  inet_network()
  126. *        for malformed requests.
  127. *
  128. *   BUGS
  129. *        The problem of host byte ordering versus network byte order-
  130. *        ing  is  confusing.  A simple way to specify Class C network
  131. *        addresses in a manner similar to that for Class B and  Class
  132. *        A is needed.
  133. *
  134. *        The return value from inet_ntoa() points to static buffer
  135. *        which  is  overwritten  in  each inet_ntoa() call.
  136. *
  137. *****************************************************************************
  138. *
  139. */
  140.  
  141. #define NOTEX
  142. /****** bsdsocket.library/Inet_LnaOf ****************************************
  143. *
  144. *   SEE ALSO
  145. *       inet_addr()
  146. *
  147. *****************************************************************************
  148. *
  149. */
  150.  
  151. #define NOTEX
  152. /****** bsdsocket.library/inet_lnaof ****************************************
  153. *
  154. *   SEE ALSO
  155. *       inet_addr()
  156. *
  157. *****************************************************************************
  158. *
  159. */
  160.  
  161. #define NOTEX
  162. /****** bsdsocket.library/inet_MakeAddr *************************************
  163. *
  164. *   SEE ALSO
  165. *       inet_addr()
  166. *
  167. *****************************************************************************
  168. *
  169. */
  170.  
  171. #define NOTEX
  172. /****** bsdsocket.library/inet_makeaddr *************************************
  173. *
  174. *   SEE ALSO
  175. *       inet_addr()
  176. *
  177. *****************************************************************************
  178. *
  179. */
  180.  
  181. #define NOTEX
  182. /****** bsdsocket.library/Inet_NetOf ****************************************
  183. *
  184. *   SEE ALSO
  185. *       inet_addr()
  186. *
  187. *****************************************************************************
  188. *
  189. */
  190.  
  191. #define NOTEX
  192. /****** bsdsocket.library/inet_netof ****************************************
  193. *
  194. *   SEE ALSO
  195. *       inet_addr()
  196. *
  197. *****************************************************************************
  198. *
  199. */
  200.  
  201. #define NOTEX
  202. /****** bsdsocket.library/inet_network **************************************
  203. *
  204. *   SEE ALSO
  205. *       inet_addr()
  206. *
  207. *****************************************************************************
  208. *
  209. */
  210.  
  211. #define NOTEX
  212. /****** bsdsocket.library/Inet_NtoA *****************************************
  213. *
  214. *   SEE ALSO
  215. *       inet_addr()
  216. *
  217. *****************************************************************************
  218. *
  219. */
  220.  
  221. #define NOTEX
  222. /****** bsdsocket.library/inet_ntoa *****************************************
  223. *
  224. *   SEE ALSO
  225. *       inet_addr()
  226. *
  227. *****************************************************************************
  228. *
  229. */
  230.